<?php
/**
 * Author: LaiGuiming
 * Time: 2017-12-01 14:19:05
 * Copyright (C) 2016 Longyan Wehome Message CO.,LTD.
 */

namespace app\admin\model;
use think\Model;

/**
 * 测试模型
 * Class Test
 * @package app\admin\model
 */
class Test extends Model
{
    protected $insert = ['status' => 0,'ct','mt'];

    protected $update = ['mt'];

    protected function setMtAttr()
    {
        return  date( "Y-m-d H:i:s ");
    }


    protected function setCtAttr()
    {
        return  date( "Y-m-d H:i:s ");
    }

    // 追加属性
    protected $append = [
       'check_text',
       'type_text'
    ];

    public function getCheckTextAttr($value, $data)
    {
        $value = $value ? $value : $data['check'];
        $list = ['0'=>'待审核','1'=>'审核通过','2'=>'审核不通过'];
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function getTypeTextAttr($value, $data)
    {
        $value = $value ? $value : $data['type'];
        $list = ['0'=>'普通','1'=>'高级','2'=>'特别'];
        return isset($list[$value]) ? $list[$value] : '';
    }


}